#!/usr/bin/env python  
# encoding: utf-8


""" 
@version: v1.0 
@author: Shylock 
@license: Apache Licence  
@contact: JYFelt@163.com 
@site: http://blog.csdn.net/weixin_38034182 
@software: PyCharm Community Edition 
@file: InfoPage.py 
@time: 2017/12/23 21:57 
"""
from tkinter import *
import MYSQL_CL as ms
import MainPage as mp


# 插入界面
class insertPage(object):
    def __init__(self, master=None):
        self.root = master  # 定义内部变量
        self.root.geometry('620x350')
        self.Gname = StringVar()
        self.createPage()

    def createPage(self):
        self.page = Frame(self.root)
        self.page.pack()
        self.show = self.showPage()

    def showPage(self):
        Button(self.page, text='返回', command=self.jumpback).grid(row=9, column=2)
        Button(self.page, text='插入信息到公司', command=self.lll).grid(row=1)

    def lll(self):
        Label(self.page, text='请输入公司名: ').grid(row=2, stick=W, pady=10)
        Entry(self.page, textvariable=self.Gname).grid(row=2, column=1, stick=E)
        Button(self.page, text='插入', command=self.www).grid(row=3, column=2)

    def www(self):
        ll = self.Gname.get()
        Label(self.page, text='插入的公司名为：' + str(ll)).grid(row=4)

    def jumpback(self):
        self.page.destroy()
        mp.MainPage(self.root)


# 查询界面
class searchPage(object):
    def __init__(self, master=None):
        self.root = master  # 定义内部变量
        self.root.geometry('620x350')
        self.createPage()

    def createPage(self):
        self.page = Frame(self.root)
        self.page.pack()
        self.show = self.showPage()

    def showPage(self):
        Button(self.page, text='查询所有公司信息', command=self.gongsi).grid(row=2)
        Button(self.page, text='查询所有求职者信息', command=self.qiuzhizhe).grid(row=3)
        Button(self.page, text='返回', command=self.jumpback).grid(row=9)

    def gongsi(self):
        str__ = str(ms.FIND_BY_SQL)
        Label(self.page, text='公司名称:%s ' % (str__)).grid(row=1)

    def qiuzhizhe(self):
        str__ = str(ms.FIND_BY_SQL_J)
        Label(self.page, text='所有求职者信息:%s ' % (str__)).grid(row=0)

    def jumpback(self):
        self.page.destroy()
        mp.MainPage(self.root)


# 修改、删除界面
class modifyPage(object):
    def __init__(self, master=None):
        self.root = master  # 定义内部变量
        self.root.geometry('620x350')
        self.createPage()

    def createPage(self):
        self.page = Frame(self.root)
        self.page.pack()
        self.show = self.showPage()

    def showPage(self):
        Button(self.page, text='返回', command=self.jumpback).grid(row=9)

    def jumpback(self):
        self.page.destroy()
        mp.MainPage(self.root)


# 关于界面
class aboutPage(object):
    def __init__(self, master=None):
        self.root = master  # 定义内部变量
        self.root.geometry('620x350')  # 设置窗口大小
        self.createPage()

    def createPage(self):
        self.page = Frame(self.root)
        self.page.pack()
        self.show = self.showPage()

    def showPage(self):
        Message1 = "职业介绍信息管理系统"
        Message2 = "v 0.23.1"
        Message3 = "@Author: Shylock 小仲马"
        Message4 = '当前连接数据库版本' + str(ms.SHOW_VERSION)
        Message5 = '返回'
        Label(self.page, text=Message1).grid(row=5)
        Label(self.page, text=Message2).grid(row=6)
        Label(self.page, text=Message3).grid(row=7)
        Label(self.page, text=Message4).grid(row=8)
        Button(self.page, text='返回', command=self.jumpback).grid(row=9)

    def jumpback(self):
        self.page.destroy()
        mp.MainPage(self.root)
